package Practice1;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 06 - 04
 * Time: 19:54
 */
public class Test {
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        String s = "";
        for(int i = 0; i < 10000; i++){
            s += i;
        }
        System.out.println(s);
        long end = System.currentTimeMillis();
        System.out.println(end - start);

        start = System.currentTimeMillis();
        StringBuffer s1 = new StringBuffer("");
        for(int i = 0; i < 10000; i++){
            s1.append(i);
        }
        end = System.currentTimeMillis();
        System.out.println(end - start);

        start = System.currentTimeMillis();
        StringBuilder s2 = new StringBuilder();
        for(int i = 0; i < 10000; i++){
            s2.append(i);
        }
        end = System.currentTimeMillis();
        System.out.println(end - start);
    }
}
